package com.filldream.fastboot.base.response.pc;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

@Data
public class MenuDTO {

    @ApiModelProperty(value = "菜单ID")
    private Long id;

    @ApiModelProperty(value = "菜单名称")
    private String name;

    @ApiModelProperty(value = "name-elementplus使用")
    public String getLabel(){
        return name;
    }

    @ApiModelProperty(value = "菜单编码")
    private String code;

    @ApiModelProperty(value = "菜单编码")
    private String icon = null;

    @ApiModelProperty(value = "是否是菜单 1-是 0-否")
    private Integer isMenu;

    @ApiModelProperty(value = "菜单跳转")
    private String menuUrl;

    @ApiModelProperty(value = "子级列表")
    private List<MenuDTO> children;

    @ApiModelProperty(value = "是否拥有该权限 0-没有 1-拥有")
    private Boolean isCheck = null;

    @ApiModelProperty(value = "父级菜单Id")
    private Long parentId;

    @ApiModelProperty(value = "排序，大大")
    private Integer menuRank;


//    @ApiModelProperty(value = "排序，负数")
//    private Integer negativeMenuRank ;

    /**
     * 如果是三级菜单为空则不返回该字段
     * @return
     */
    public List<MenuDTO> getChildren() {
        if(children == null || (children.isEmpty() && isMenu.equals(0))){
            return null;
        }
        return children;
    }

    public Integer getNegativeMenuRank() {
        return menuRank * -1;
    }

//    public void setNegativeMenuRank(Integer negativeMenuRank) {
//        this.negativeMenuRank = menuRank * -1;;
//    }



}
